package team.kirohuji.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import team.kirohuji.dao.AttendanceDao;
import team.kirohuji.domain.Attendance;
import team.kirohuji.service.AttendanceService;

/**
* 
* what
* 
* @author kirohuji
* @version 0.1
*/
@Service("attendanceService")
public class AttendanceServiceImpl implements AttendanceService {
	@Resource
	private AttendanceDao attendanceDao;
	@Override
	public Attendance queryObject(Integer attendanceId) {
		return attendanceDao.queryObject(attendanceId);
	}

	@Override
	public List<Attendance> queryList(Map<String, Object> map) {
		return attendanceDao.queryList(map);
	}

	@Override
	public int queryTotal(Map<String, Object> map) {
		return attendanceDao.queryTotal(map);
	}

	@Override
	public void save(Attendance attendance) throws IllegalArgumentException {
		attendanceDao.save(attendance);
	}

	@Override
	public void update(Attendance attendance) throws IllegalArgumentException {
		attendanceDao.update(attendance);
	}

	@Override
	public void deleteBatch(Integer[] ids) {
		attendanceDao.deleteBatch(ids);
		
	}

	@Override
	public void saveOrUpdate(Attendance record) {
		if(queryObjectByUserId(record.getSystemUserId())!=null) {
			attendanceDao.save(record);
		}else {
			attendanceDao.update(record);
		}
	}

	@Override
	public Attendance queryObjectByUserId(Integer systemUserId) {
		return attendanceDao.queryObjectByUserId(systemUserId);
	}

}
